import urlHook from "@page/common/utils/urlHook";

export default class TextItem extends React.Component {
    render() {
        const { item, index } = this.props;
        const { title, num } = item;
        return (
            <div
                onClick={() => {
                    if (index == 1) {
                        window.location.href = urlHook.daijiesuan;
                    } else if(index == 0){
                        window.location.href = urlHook.order5;
                    }else if(index == 2){
                        window.location.href = urlHook.order4;
                    }
                }}
                className={"banner-header-personinfo-bottom-item"}
            >
                <p className={"banner-header-personinfo-bottom-p1"}>
                    {this.getNum(title)}
                </p>
                <p className={"banner-header-personinfo-bottom-p2"}>{title}</p>
            </div>
        );
    }

    getNum(title) {
        const {
            notDeliverOrderCount,
            notBanlanceOrderCount,
            notTakeOrderCount
        } = this.props;
        switch (title) {
            case "待验收":
                return notTakeOrderCount;
            case "待结算":
                return notBanlanceOrderCount;
            case "待发货":
                return notDeliverOrderCount;
            default:
                return 0;
        }
    }
}
